﻿<common:LayoutAwarePage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:MyMumsPC"
    xmlns:common="using:MyMumsPC.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:clr="using:PennApps"
    xmlns:dm="using:MyMumsPC.DataModel"
    xmlns:drawing="using:StoreAppLib.Graph"
    xmlns:charting="using:WinRTXamlToolkit.Controls.DataVisualization.Charting"
    x:Name="pageRoot"
    x:Class="MyMumsPC.GroupDetailPage"
    mc:Ignorable="d">

    <common:LayoutAwarePage.Resources>
        <dm:ProcessPerformanceInformationGroup x:Key="designTime">
            <dm:ProcessPerformanceInformationGroup.Collection>
                <clr:ProcessPerformanceInformationExtended ProcessName="Mock1" CPUUsage="100"/>
                <clr:ProcessPerformanceInformationExtended ProcessName="Mock2" CPUUsage="80"/>
                <clr:ProcessPerformanceInformationExtended ProcessName="Mock3" CPUUsage="40"/>
                <clr:ProcessPerformanceInformationExtended ProcessName="Mock4" CPUUsage="20"/>
            </dm:ProcessPerformanceInformationGroup.Collection>
        </dm:ProcessPerformanceInformationGroup>
        <!-- Collection of items displayed by this page -->
    </common:LayoutAwarePage.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
	<Grid
		Style="{StaticResource LayoutRootStyle}">

		<Grid.RowDefinitions>
			<RowDefinition Height="140"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<!-- Horizontal scrolling grid used in most view states -->

		<!-- Vertical scrolling list only used when snapped -->

		<VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
			<VisualStateGroup x:Name="ApplicationViewStates">
				<VisualState x:Name="FullScreenLandscape"/>
				<VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
				<VisualState x:Name="FullScreenPortrait">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
							<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
						</ObjectAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>

                <!--
                    The back button and title have different styles when snapped, and the list representation is substituted
                    for the grid displayed in all other view states
                -->
				<VisualState x:Name="Snapped">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
							<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
						</ObjectAnimationUsingKeyFrames>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
							<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
						</ObjectAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>

		<!-- Back button and page title -->
		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto"/>
				<ColumnDefinition Width="*"/>
			</Grid.ColumnDefinitions>
			<Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
			<TextBlock x:Name="pageTitle" Text="MY MUM'S PC" Style="{StaticResource PageHeaderTextStyle}" Grid.Column="1" IsHitTestVisible="false"/>
		</Grid>
		<StackPanel Margin="118,12,862,42" Grid.Row="1">
			<TextBlock  Margin="0,0,18,20" Style="{StaticResource SubheaderTextStyle}" MaxHeight="60" >
				<Run Text="currently running app "/>
				<Run Text="114" x:Name="appCnt" Foreground="{StaticResource ListViewItemDragBackgroundThemeBrush}"/>
			</TextBlock>
			<ListBox ScrollViewer.VerticalScrollMode="Auto"  ItemsSource="{Binding Collection, Source={StaticResource designTime}}" x:Name="processList" ItemTemplate="{StaticResource ProcessItemTemplate}" Background="{x:Null}" Foreground="White" Style="{StaticResource ListBoxDark}" Height="519" ItemContainerStyle="{StaticResource ListBoxItemStyle1}"/>
			<TextBlock Text="{Binding Description}" Margin="0,0,18,0" Style="{StaticResource BodyTextStyle}"/>
		</StackPanel>
		<StackPanel x:Name="infoStack" Margin="551,21,615,10" Grid.Row="1">
			<Grid Height="159" Margin="20,10,20,0">
                <ProgressBar VerticalAlignment="Stretch" Width="159" Value="{Binding TotalIOCount}"/>
                <TextBlock HorizontalAlignment="Center" Margin="1,0,0,0" Text="{Binding TotalIOCount}" TextWrapping="Wrap"  VerticalAlignment="Center" FontSize="64" TextAlignment="Center"/>
			</Grid>
			<Grid Height="159" Margin="20,30,20,0">
				<ProgressBar VerticalAlignment="Stretch" Width="159" Value="{Binding CPUUsage}"/>
                <TextBlock HorizontalAlignment="Center" Margin="46,41.1,45,40.9" Text="{Binding CPUUsage}" TextWrapping="Wrap" VerticalAlignment="Center" FontSize="64" TextAlignment="Center"/>
			</Grid>
			<Grid Height="159" Margin="20,30,20,0">
				<ProgressBar VerticalAlignment="Stretch" Width="159" Value="{Binding MemoryUsage}"/>
                <TextBlock HorizontalAlignment="Center" Margin="46,41.1,45,40.9" Text="{Binding MemoryUsage}" TextWrapping="Wrap" VerticalAlignment="Center" FontSize="64" TextAlignment="Center"/>
			</Grid>
		</StackPanel>
		<Grid x:Name="busyGrid" Margin="118,275,918,293" Grid.Row="1">
			<ProgressRing HorizontalAlignment="Left" Height="60" VerticalAlignment="Top" Width="60" IsActive="True"/>
			<TextBlock HorizontalAlignment="Left" Height="24" Margin="65,23,0,0" TextWrapping="Wrap" Text="Just a moment..." VerticalAlignment="Top" Width="255" FontSize="14.667"/>
		</Grid>
		<Button Click="deleteSelected_Click" x:Name="deleteSelected" Content="delete" HorizontalAlignment="Left" Height="46" Margin="844,31,0,551" Width="184" Grid.Row="1"/>
	</Grid>
</common:LayoutAwarePage>
